package cn.yuanqiao.archive.shuzihua.service.impl;


import cn.yuanqiao.archive.shuzihua.domain.ArchiveEnroll;
import cn.yuanqiao.archive.shuzihua.mapper.ArchiveEnrollMapper;
import cn.yuanqiao.archive.shuzihua.service.IArchiveEnrollService;
import cn.yuanqiao.common.utils.DateUtils;
import cn.yuanqiao.common.utils.SecurityUtils;
import cn.yuanqiao.common.utils.SnowflakeIdGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 档案登记记录Service业务层处理
 * 
 * @author xy
 * @date 2024-09-12
 */
@Service
public class ArchiveEnrollServiceImpl implements IArchiveEnrollService
{
    @Autowired
    private ArchiveEnrollMapper archiveEnrollMapper;

    /**
     * 查询档案登记记录
     * 
     * @param id 档案登记记录主键
     * @return 档案登记记录
     */
    @Override
    public ArchiveEnroll selectArchiveEnrollById(Long id)
    {
        return archiveEnrollMapper.selectArchiveEnrollById(id,new ArchiveEnroll().getTableName(),SecurityUtils.getTenantCode());
    }

    /**
     * 查询档案登记记录列表
     * 
     * @param archiveEnroll 档案登记记录
     * @return 档案登记记录
     */
    @Override
    public List<ArchiveEnroll> selectArchiveEnrollList(ArchiveEnroll archiveEnroll)
    {
        return archiveEnrollMapper.selectArchiveEnrollList(archiveEnroll,SecurityUtils.getTenantCode());
    }

    /**
     * 新增档案登记记录
     * 
     * @param archiveEnroll 档案登记记录
     * @return 结果
     */
    @Override
    public int insertArchiveEnroll(ArchiveEnroll archiveEnroll)
    {
        archiveEnroll.setId(SnowflakeIdGenerator.generateId());
        archiveEnroll.setCreateTime(DateUtils.getNowDate());
        archiveEnroll.setCreateId(SecurityUtils.getUserId());
        return archiveEnrollMapper.insertArchiveEnroll(archiveEnroll);
    }

    /**
     * 修改档案登记记录
     * 
     * @param archiveEnroll 档案登记记录
     * @return 结果
     */
    @Override
    public int updateArchiveEnroll(ArchiveEnroll archiveEnroll)
    {
        return archiveEnrollMapper.updateArchiveEnroll(archiveEnroll);
    }

    /**
     * 批量删除档案登记记录
     * 
     * @param ids 需要删除的档案登记记录主键
     * @return 结果
     */
    @Override
    public int deleteArchiveEnrollByIds(Long[] ids)
    {
        return archiveEnrollMapper.deleteArchiveEnrollByIds(ids,new ArchiveEnroll().getTableName());
    }

    /**
     * 删除档案登记记录信息
     * 
     * @param id 档案登记记录主键
     * @return 结果
     */
    @Override
    public int deleteArchiveEnrollById(Long id)
    {
        return archiveEnrollMapper.deleteArchiveEnrollById(id);
    }

    @Override
    public List<ArchiveEnroll> exportArchiveEnrollList(ArchiveEnroll archiveEnroll) {
        return archiveEnrollMapper.exportArchiveEnrollList(archiveEnroll,SecurityUtils.getTenantCode());
    }
}
